package com.haizhi.bean;

// Generated 2016-8-15 17:44:37 by Hibernate Tools 3.2.2.GA

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Entity: 
 */
@Entity
@Table(name = "tb_post", catalog = "db_lemon3d")
public class TbPost implements java.io.Serializable {

	/** 
	 * ����id.
	 */

	private Integer postId;

	/** 
	 * ���id.
	 */

	private TbSection tbSection;

	/** 
	 * ������id.
	 */

	private TbUser tbUser;

	/** 
	 * ���ӱ���.
	 */

	private String postTitle;

	/** 
	 * ��������.
	 */

	private String postContent;

	/** 
	 * ����ʱ��.
	 */

	private Date postTime;

	/** 
	 * �ظ�����.
	 */

	private int postReplyNum;

	/** 
	 * ����״̬��1Ϊ������2Ϊ����.
	 */

	private int postType;

	private Set<TbReply> tbReplies = new HashSet<TbReply>(0);

	public TbPost() {
	}

	public TbPost(TbSection tbSection, TbUser tbUser, String postTitle,
			String postContent, Date postTime, int postReplyNum, int postType) {
		setTbSection(tbSection);
		setTbUser(tbUser);
		setPostTitle(postTitle);
		setPostContent(postContent);
		setPostTime(postTime);
		setPostReplyNum(postReplyNum);
		setPostType(postType);
	}

	public TbPost(TbSection tbSection, TbUser tbUser, String postTitle,
			String postContent, Date postTime, int postReplyNum, int postType,
			Set<TbReply> tbReplies) {
		setTbSection(tbSection);
		setTbUser(tbUser);
		setPostTitle(postTitle);
		setPostContent(postContent);
		setPostTime(postTime);
		setPostReplyNum(postReplyNum);
		setPostType(postType);
		setTbReplies(tbReplies);
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "post_id", unique = true, nullable = false)
	public Integer getPostId() {
		return this.postId;
	}

	public void setPostId(Integer postId) {
		this.postId = postId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "post_section_id", nullable = false)
	public TbSection getTbSection() {
		return this.tbSection;
	}

	public void setTbSection(TbSection tbSection) {
		this.tbSection = tbSection;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "user_id", nullable = false)
	public TbUser getTbUser() {
		return this.tbUser;
	}

	public void setTbUser(TbUser tbUser) {
		this.tbUser = tbUser;
	}

	@Column(name = "post_title", nullable = false, length = 40)
	public String getPostTitle() {
		return this.postTitle;
	}

	public void setPostTitle(String postTitle) {
		this.postTitle = postTitle;
	}

	@Column(name = "post_content", nullable = false, length = 3000)
	public String getPostContent() {
		return this.postContent;
	}

	public void setPostContent(String postContent) {
		this.postContent = postContent;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "post_time", nullable = false, length = 19)
	public Date getPostTime() {
		return this.postTime;
	}

	public void setPostTime(Date postTime) {
		this.postTime = postTime;
	}

	@Column(name = "post_reply_num", nullable = false)
	public int getPostReplyNum() {
		return this.postReplyNum;
	}

	public void setPostReplyNum(int postReplyNum) {
		this.postReplyNum = postReplyNum;
	}

	@Column(name = "post_type", nullable = false)
	public int getPostType() {
		return this.postType;
	}

	public void setPostType(int postType) {
		this.postType = postType;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "tbPost")
	public Set<TbReply> getTbReplies() {
		return this.tbReplies;
	}

	public void setTbReplies(Set<TbReply> tbReplies) {
		this.tbReplies = tbReplies;
	}

}
